package com.taikang.base;


import com.google.common.base.Optional;
import com.taikang.auth.entity.User;

public class AdminUserHolder {

    private static final ThreadLocal<User> CURRENT_USER = new ThreadLocal<>();

    public static void setCurrentUser(User currentUser) {
        CURRENT_USER.set(currentUser);
    }

    public static void remove() {
        CURRENT_USER.remove();
    }

    public static Optional<User> getCurrentUser() {
        return Optional.fromNullable(CURRENT_USER.get());
    }

}
